package cn.gson.crm.model.pojo;

import java.io.Serializable;
import javax.persistence.*;

import com.alibaba.fastjson.annotation.JSONField;

import java.math.BigDecimal;
import java.util.List;


/**
 * The persistent class for the EMP database table.
 * 
 */
@Entity
@NamedQuery(name="Emp.findAll", query="SELECT e FROM Emp e")
public class Emp implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name="EMP_GENERATOR",sequenceName="SEQ_EMP")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="EMP_GENERATOR")
	@Column(name="EMP_ID")
	private long empId;

	@Column(name="EMP_AGE")
	private BigDecimal empAge;

	@Column(name="EMP_EMAIL")
	private String empEmail;

	@Column(name="EMP_HEAD")
	private String empHead;

	@Column(name="EMP_JOB")
	private String empJob;

	@Column(name="EMP_NAME")
	private String empName;

	@Column(name="EMP_PASSWORD")
	private String empPassword;

	@Column(name="EMP_QQ")
	private String empQq;

	@Column(name="EMP_SEX")
	private String empSex;

	@Column(name="EMP_STATUS")
	private String empStatus;

	@Column(name="EMP_TEL")
	private String empTel;

	@Column(name="EMP_USERNAME")
	private String empUsername;

	//bi-directional many-to-one association to Dept
	@ManyToOne
	@JoinColumn(name="DEPT_ID")
	private Dept dept;

	//bi-directional many-to-one association to EmpsRole
	@OneToMany(mappedBy="emp")
	@JSONField(serialize=false)
	private List<EmpsRole> empsRoles;

	public Emp() {
	}

	public long getEmpId() {
		return this.empId;
	}

	public void setEmpId(long empId) {
		this.empId = empId;
	}

	public BigDecimal getEmpAge() {
		return this.empAge;
	}

	public void setEmpAge(BigDecimal empAge) {
		this.empAge = empAge;
	}

	public String getEmpEmail() {
		return this.empEmail;
	}

	public void setEmpEmail(String empEmail) {
		this.empEmail = empEmail;
	}

	public String getEmpHead() {
		return this.empHead;
	}

	public void setEmpHead(String empHead) {
		this.empHead = empHead;
	}

	public String getEmpJob() {
		return this.empJob;
	}

	public void setEmpJob(String empJob) {
		this.empJob = empJob;
	}

	public String getEmpName() {
		return this.empName;
	}

	public void setEmpName(String empName) {
		this.empName = empName;
	}

	public String getEmpPassword() {
		return this.empPassword;
	}

	public void setEmpPassword(String empPassword) {
		this.empPassword = empPassword;
	}

	public String getEmpQq() {
		return this.empQq;
	}

	public void setEmpQq(String empQq) {
		this.empQq = empQq;
	}

	public String getEmpSex() {
		return this.empSex;
	}

	public void setEmpSex(String empSex) {
		this.empSex = empSex;
	}

	public String getEmpStatus() {
		return this.empStatus;
	}

	public void setEmpStatus(String empStatus) {
		this.empStatus = empStatus;
	}

	public String getEmpTel() {
		return this.empTel;
	}

	public void setEmpTel(String empTel) {
		this.empTel = empTel;
	}

	public String getEmpUsername() {
		return this.empUsername;
	}

	public void setEmpUsername(String empUsername) {
		this.empUsername = empUsername;
	}

	public Dept getDept() {
		return this.dept;
	}

	public void setDept(Dept dept) {
		this.dept = dept;
	}

	public List<EmpsRole> getEmpsRoles() {
		return this.empsRoles;
	}

	public void setEmpsRoles(List<EmpsRole> empsRoles) {
		this.empsRoles = empsRoles;
	}

	public EmpsRole addEmpsRole(EmpsRole empsRole) {
		getEmpsRoles().add(empsRole);
		empsRole.setEmp(this);

		return empsRole;
	}

	public Emp(BigDecimal empAge, String empEmail, String empJob, String empName, String empPassword, String empQq,
			String empSex, String empStatus, String empTel, String empUsername) {
		super();
		this.empAge = empAge;
		this.empEmail = empEmail;
		this.empJob = empJob;
		this.empName = empName;
		this.empPassword = empPassword;
		this.empQq = empQq;
		this.empSex = empSex;
		this.empStatus = empStatus;
		this.empTel = empTel;
		this.empUsername = empUsername;
	}

	public EmpsRole removeEmpsRole(EmpsRole empsRole) {
		getEmpsRoles().remove(empsRole);
		empsRole.setEmp(null);

		return empsRole;
	}

}